package org.sbbs.security.service.impl;

import java.util.Iterator;
import java.util.List;

import org.sbbs.base.service.impl.BaseManagerImpl;
import org.sbbs.security.dao.UrlResourceDao;
import org.sbbs.security.model.UrlResource;
import org.sbbs.security.service.UrlResourceManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("urlResourceManager")
public class UrlResourceManagerImpl extends BaseManagerImpl<UrlResource, Long> implements UrlResourceManager {
	private UrlResourceDao urlResourceDao;

	@Autowired
	public UrlResourceManagerImpl(UrlResourceDao urlResourceDao) {
		super(urlResourceDao);
		this.urlResourceDao = urlResourceDao;
	}

	@Override
	public void initUrlResourceRepo(List resList) {
		for (Iterator iterator = resList.iterator(); iterator.hasNext();) {
			UrlResource res = (UrlResource) iterator.next();
			this.urlResourceDao.save(res);
		}
	}
}
